import 'package:shared_preferences/shared_preferences.dart';

enum StoreKey {
  token,
  city,
}

class Store {
  final SharedPreferences _store;

  static getInstance() async {
    SharedPreferences sp = await SharedPreferences.getInstance();
    return Store._internal(sp);
  }

  Store._internal(this._store);

  getString(StoreKey key) {
    return _store.getString(key.toString());
  }

  setString(StoreKey key, String value) async {
    _store.setString(key.toString(), value);
  }

  getStringList(StoreKey key) {
    return _store.getStringList(key.toString());
  }

  setStringList(StoreKey key, List<String> value) async {
    _store.setStringList(key.toString(), value);
  }
}
